<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="http://Microsoft.ConnectionEngine/Schemas/PatientRegister" elementFormDefault="qualified" targetNamespace="http://Microsoft.ConnectionEngine/Schemas/PatientRegister" xmlns:xs="http://www.w3.org/2001/XMLSchema"  attributeFormDefault="unqualified">
  <xs:element name="PatientRequest" nillable="true">
    <xs:complexType>
      <xs:sequence>
		  <xs:element minOccurs="1" maxOccurs="1" name="UserCredentials" type="UserCredentials" />
		  <xs:element minOccurs="1" maxOccurs="1" name="Patient" type="Patient" />
	  </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="UserCredentials">
    <xs:sequence>
      <xs:element minOccurs="1" maxOccurs="1" name="UserName" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="1" name="Password" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Patient">
    <xs:complexContent mixed="false">
      <xs:extension base="Person">
        <xs:sequence>
          <xs:element minOccurs="0" maxOccurs="1" name="PatientID" type="xs:string" />
          <xs:element minOccurs="0" maxOccurs="1" name="AddressLine1" type="xs:string" />
          <xs:element minOccurs="0" maxOccurs="1" name="AddressLine2" type="xs:string" />
          <xs:element minOccurs="0" maxOccurs="1" name="AddressSuburb" type="xs:string" />
          <xs:element minOccurs="0" maxOccurs="1" name="AddressTownCity" type="xs:string" />
          <xs:element minOccurs="0" maxOccurs="1" name="AddressCountry" type="xs:string" />
          <xs:element minOccurs="0" maxOccurs="1" name="AddressCode" type="xs:string" />
          <xs:element minOccurs="1" maxOccurs="1" name="DonorFlag" type="xs:boolean" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Person">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="1" name="Names" type="ArrayOfName" />
      <xs:element minOccurs="1" maxOccurs="1" name="DateOfBirth" type="xs:dateTime" />
      <xs:element minOccurs="1" maxOccurs="1" name="DateOfDeath" type="xs:dateTime" />
      <xs:element minOccurs="0" maxOccurs="1" name="Gender" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="ArrayOfName">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="Name" nillable="true" type="Name" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Name">
    <xs:sequence>
      <xs:element minOccurs="1" maxOccurs="1" name="PrimaryAlias" type="xs:boolean" />
      <xs:element minOccurs="0" maxOccurs="1" name="FamilyName" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="GivenName1" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="GivenName2" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="GivenName3" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="1" name="PreferredGivenNameIndex" type="xs:int" />
      <xs:element minOccurs="0" maxOccurs="1" name="Title" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="1" name="Status" type="NameStatus" />
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="NameStatus">
    <xs:restriction base="xs:string">
      <xs:enumeration value="update" />
      <xs:enumeration value="insert" />
      <xs:enumeration value="none" />
    </xs:restriction>
  </xs:simpleType>
</xs:schema>